﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MyWebUI1
{
    public class ApplicationContext
    {
        public static string Theme
        {
            get
            {
                //从客户端取
                string theme = SiteUtil.GetString(SiteConstants.CurrentTheme);
                HttpCookie cookie = HttpContext.Current.Request.Cookies[SiteConstants.CurrentTheme];
                // 先从Cookie中取
                if (theme != null)
                {
                    theme = cookie.Value;// "default";
                    //theme = "default";// "default";
                }

                if (String.IsNullOrEmpty(theme))
                {
                    //从配置中取
                    //UIConfiguration ui = ApplicationConfiguration.GetUIConfiguration(CurrentOwnerId.Value, UserId);
                    //theme = ui.Theme;

                    //如果从配置中取不到，就直接赋默认值:Silver
                    if (String.IsNullOrEmpty(theme))
                    {
                        theme = "default";
                    }

                    SiteUtil.SetString(SiteConstants.CurrentTheme, theme);
                }

                return theme;
            }
        }
    }
}
